/******************************************************************************
 * vrtwarpedoverview.h
 *
 * Project:  Virtual GDAL Datasets
 * Purpose:  Implementation of VRTWarpedOverviewDataset.
 * Author:   Dmitry Baryshnikov (Bishop) <polimax@mail.ru>
 *
 ******************************************************************************
 * Copyright (c) 2010, Dmitry Baryshnikov (Bishop) <polimax@mail.ru>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 ****************************************************************************/
 
#ifndef VRTWARPEDOVERVIEW_H_INCLUDED
#define VRTWARPEDOVERVIEW_H_INCLUDED

#include "gdal_priv.h"
#include "gdal_vrt.h"

CPL_C_START
/************************************************************************/
/*                      VRTWarpedOverviewDataset                        */
/************************************************************************/

class CPL_DLL VRTWarpedOverviewDataset : public GDALDataset
{
public:
	VRTWarpedOverviewDataset(GDALDataset* pOverviewDS, GDALDataset* pParentDS);
	virtual ~VRTWarpedOverviewDataset(void);
    GDALRasterBand *GetRasterBand( int );
    virtual const char *GetProjectionRef(void);
    virtual CPLErr SetProjection( const char * );

    virtual CPLErr GetGeoTransform( double * );
    virtual CPLErr SetGeoTransform( double * );
    virtual int    GetGCPCount();
    virtual const char *GetGCPProjection();
    virtual const GDAL_GCP *GetGCPs();
    virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
                            const char *pszGCPProjection );

    virtual CPLErr AdviseRead( int nXOff, int nYOff, int nXSize, int nYSize,
                               int nBufXSize, int nBufYSize, 
                               GDALDataType eDT, 
                               int nBandCount, int *panBandList,
                               char **papszOptions );
    virtual CPLErr          CreateMaskBand( int nFlags );

    CPLErr      RasterIO( GDALRWFlag, int, int, int, int,
                          void *, int, int, GDALDataType,
                          int, int *, int, int, int );
    GDALAccess    GetAccess() { return GA_ReadOnly; }
protected:
    char          *pszProjection;

    int           bGeoTransformValid;
    double        adfGeoTransform[6];

    int           nGCPCount;
    GDAL_GCP      *pasGCPList;
    char          *pszGCPProjection;
	
	GDALDataset	  *m_pInternalDS;
};

CPL_C_END

#endif // ndef VRTWARPEDOVERVIEW_H_INCLUDED
 
 